<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:o="http://omnifaces.org/ui"
      xmlns:jsf="http://xmlns.jcp.org/jsf"
      xmlns:iqbs="http://xmlns.jcp.org/jsf/composite/iqbs">
    <h:head>
    </h:head>
    <h:body>
        <f:metadata>
            <f:viewParam name="id" value="#{manageFilePermissionsPage.dataset.id}"/>
            <f:viewAction action="#{dataverseSession.updateLocaleInViewRoot}"/>
            <f:viewAction action="#{manageFilePermissionsPage.init}"/>
            <f:viewAction action="#{dataverseHeaderFragment.initBreadcrumbs(manageFilePermissionsPage.dataset, bundle['dataverse.permissionsFiles.title'])}"/>
        </f:metadata>
        <ui:composition template="/dataverse_template.xhtml">
            <ui:param name="pageTitle" value="#{bundle['dataverse.permissionsFiles.title']} - #{manageFilePermissionsPage.dataset.displayName}"/>
            <ui:param name="dataverse" value="#{manageFilePermissionsPage.dataset.dataverseContext}"/>
            <ui:param name="dataset" value="#{manageFilePermissionsPage.dataset}"/>
            <ui:param name="version" value="#{manageFilePermissionsPage.dataset.latestVersion}"/>
            <ui:param name="showMessagePanel" value="false"/>
            <ui:define name="body">
                <h:form id="rolesPermissionsForm" styleClass="margin-top">
                    <div class="panel-group">
                        <!-- Users/Groups Access Panel -->
                        <div class="panel panel-default">
                            <div data-toggle="collapse" data-target="#panelCollapseUsersGroups" class="panel-heading text-info">
                                #{bundle['dataverse.permissionsFiles.usersOrGroups']} <span class="glyphicon glyphicon-chevron-up"/>
                                
                                <span class="text-muted small pull-right">#{bundle['dataverse.permissionsFiles.usersOrGroups.description']}</span>
                            </div>
                            <div id="panelCollapseUsersGroups" class="collapse in">
                                <div class="panel-body">
                                    <p:fragment id="userGroupMessages">
                                        <div class="messagePanel">
                                            <iqbs:messages collapsible="true"/>
                                        </div>
                                    </p:fragment>
                                    <div class="margin-bottom text-right">
                                        <p:commandLink id="userGroupsAdd" styleClass="btn btn-default"
                                                       actionListener="#{manageFilePermissionsPage.initAssignDialog}"
                                                       update="assignDialog"
                                                       oncomplete="PF('assignWidget').show();handleResizeDialog('assignDialog');bind_bsui_components();">
                                            <span class="glyphicon glyphicon-user"/> #{bundle['dataverse.permissionsFiles.usersOrGroups.assignBtn']}
                                        </p:commandLink>
                                    </div>
                                    <div>
                                        <p:fragment id="userGroupsRequests" rendered="#{!empty manageFilePermissionsPage.fileAccessRequestMap.entrySet().toArray()}">
                                            <p>
                                                <span class="highlightBold">#{manageFilePermissionsPage.fileAccessRequestMap.size()} #{bundle['dataverse.permissions.requests']} </span>
                                            </p>
                                            
                                            <p:dataTable id="fileAccessRequests" styleClass="margin-bottom" var="access" value="#{manageFilePermissionsPage.fileAccessRequestMap.entrySet().toArray()}">
                                                <p:column width="25%" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.userOrGroup']}" >
                                                    <h:outputText value="#{access.key.displayInfo.title}"/>
                                                    <h:outputText value=" (#{access.key.displayInfo.affiliation})" rendered="#{!empty access.key.displayInfo.affiliation}"/>
                                                </p:column>
                                                <p:column width="10%" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.id']}">
                                                    <h:outputText value="#{access.key.identifier}"/>
                                                </p:column>
                                                <p:column width="15%" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.authentication']}">
                                                    <h:outputText value="#{manageFilePermissionsPage.getAuthProviderFriendlyName(access.key.authProviderId)}"/>
                                                </p:column>
                                                <p:column width="15%" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.email']}">
                                                    <h:outputText value="#{access.key.email}" rendered="#{!empty access.key.email}"/>
                                                </p:column>
                                                <p:column width="10%" class="text-center" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.files']}">
                                                    <p:commandLink id="viewUserGroups"
                                                                   actionListener="#{manageFilePermissionsPage.initAssignDialogForFileRequester(access.key)}"
                                                                   update=":#{p:resolveClientId('rolesPermissionsForm:assignDialog', view)}"
                                                                   oncomplete="PF('assignWidget').show();">
                                                        <h:outputText value="#{access.value.size()} #{access.value.size() eq 1 ?  bundle['dataverse.permissionsFiles.usersOrGroups.file'] : bundle['dataverse.permissionsFiles.usersOrGroups.files']}"/>
                                                    </p:commandLink>
                                                </p:column>
                                                <p:column width="25%" class="text-center" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.access']}">
                                                    <div class="btn-group" role="group" aria-label="access">
                                                        <p:commandLink styleClass="btn btn-default"
                                                                       actionListener="#{manageFilePermissionsPage.grantAccessToAllRequests(access.key)}"
                                                                       update="@form"
                                                                       oncomplete="bind_bsui_components();">
                                                            <span class="glyphicon glyphicon-ok"/> #{bundle['dataverse.permissionsFiles.assignDialog.grantBtn']}
                                                        </p:commandLink>
                                                        <p:commandLink styleClass="btn btn-default"
                                                                       actionListener="#{manageFilePermissionsPage.rejectAccessToAllRequests(access.key)}"
                                                                       update="@form"
                                                                       oncomplete="bind_bsui_components();">
                                                            <span class="glyphicon glyphicon-ban-circle"/> #{bundle['dataverse.permissionsFiles.assignDialog.rejectBtn']}
                                                        </p:commandLink>
                                                    </div>
                                                </p:column>
                                            </p:dataTable>
                                        </p:fragment>
                                        <p:fragment id="userGroups">
                                            <p>
                                                <span class="highlightBold">#{manageFilePermissionsPage.roleAssigneeMap.size()} #{bundle['dataverse.permissions.usersOrGroups']}</span>
                                            </p>
                                            
                                            <p:dataTable id="userGroupsAccess" var="ra" value="#{manageFilePermissionsPage.roleAssigneeMap.entrySet().toArray()}"
                                                         emptyMessage="#{bundle['dataverse.permissionsFiles.usersOrGroups.invalidMsg']}">
                                                <p:column width="35%" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.userOrGroup']}">
                                                    <h:outputText value="#{ra.key.displayInfo.title}"/>
                                                    <h:outputText value=" (#{ra.key.displayInfo.affiliation})" rendered="#{!empty ra.key.displayInfo.affiliation}"/>
                                                </p:column>
                                                <p:column width="15%" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.id']}">
                                                    <h:outputText value="#{ra.key.identifier}"/>
                                                </p:column>
                                                <p:column width="20%" class="text-center" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.files']}">
                                                    <p:commandLink id="viewUserGroups" styleClass="btn btn-default"
                                                                   actionListener="#{manageFilePermissionsPage.initViewRemoveDialogByRoleAssignee(ra.key, ra.value)}"
                                                                   update=":#{p:resolveClientId('rolesPermissionsForm:viewRemoveDialog', view)}"
                                                                   oncomplete="PF('viewRemoveWidget').show(); bind_bsui_components();">
                                                        <h:outputText value="#{ra.value.size()} #{ra.value.size() eq 1 ?  bundle['dataverse.permissionsFiles.usersOrGroups.file'] : bundle['dataverse.permissionsFiles.usersOrGroups.files']}"/>
                                                    </p:commandLink>
                                                </p:column>
                                                <p:column width="30%" class="text-center" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.access']}">
                                                    <p:commandLink styleClass="btn btn-default"
                                                                   update=":#{p:resolveClientId('rolesPermissionsForm:userGroups', view)} :#{p:resolveClientId('rolesPermissionsForm:restrictedFiles', view)} @([id$=Messages])"
                                                                   actionListener="#{manageFilePermissionsPage.showUserGroupMessages}"
                                                                   onclick="PF('confirmation').show()">
                                                        <f:setPropertyActionListener value="#{ra.value}" target="#{manageFilePermissionsPage.selectedRoleAssignmentRows}" />
                                                        <span class="glyphicon glyphicon-remove"/> #{bundle['dataverse.permissionsFiles.viewRemoveDialog.removeBtn']}
                                                    </p:commandLink>
                                                </p:column>
                                            </p:dataTable>
                                        </p:fragment>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- Files (Restricted) Panel -->
                        <div class="panel panel-default">
                            <div data-toggle="collapse" data-target="#panelCollapseFiles" class="panel-heading text-info">
                                #{bundle['dataverse.permissionsFiles.files']} <span class="glyphicon glyphicon-chevron-down"/>
                                
                                <span class="text-muted small pull-right">#{bundle['dataverse.permissionsFiles.files.description']}</span>
                            </div>
                            <div id="panelCollapseFiles" class="collapse">
                                <div class="panel-body">
                                    <!-- 只留下一个userGroupMessages panel就行了 -->
                                    <!--<p:fragment id="filesMessages">
                                        <div class="messagePanel">
                                            <iqbs:messages  collapsible="true"/>
                                        </div>
                                    </p:fragment>-->
                                    
                                    <p>
                                        <h:outputFormat styleClass="highlightBold" value="#{manageFilePermissionsPage.fileMap.size()} #{bundle['dataverse.permissionsFiles.files.label']}">
                                            <f:param value="#{manageFilePermissionsPage.fileMap.size()}"/>
                                        </h:outputFormat>
                                    </p>
                                    
                                    <p:dataTable id="restrictedFiles" var="fileEntry" value="#{manageFilePermissionsPage.fileMap.entrySet().toArray()}"
                                                 emptyMessage="#{bundle['dataverse.permissionsFiles.files.invalidMsg']}">
                                        <p:column width="40%" headerText="#{bundle['dataverse.permissionsFiles.files.tabHeader.fileName']}">
                                            <h:outputText value="#{fileEntry.key.displayName}"/>
                                        </p:column>
                                        <p:column width="10%" class="text-center" headerText="#{bundle['dataverse.permissionsFiles.files.tabHeader.publishedRestrictedState']}" rendered="#{manageFilePermissionsPage.dataset.released}">
                                            <c:set var="fileVersionCount" value="#{fileEntry.key.fileMetadatas.size()}" />
                                            <c:set var="fileVersion" value="#{fileEntry.key.fileMetadata.datasetVersion.id}" />
                                            <c:set var="dsPublishedVersion" value="#{manageFilePermissionsPage.dataset.releasedVersion.id}" />
                                            <c:set var="fileRestricted" value="#{fileEntry.key.restricted}" />
                                            <h:outputText value="#{bundle['dataverse.permissionsFiles.files.deleted']}" rendered="#{fileVersion lt dsPublishedVersion}"/>
                                            <h:outputText value="#{bundle['dataverse.permissionsFiles.files.restricted']}" rendered="#{fileRestricted and fileVersion ge dsPublishedVersion}"/>
                                            <h:outputText value="#{bundle['dataverse.permissionsFiles.files.public']}" rendered="#{!fileRestricted and fileVersionCount ne 1}"/>
                                        </p:column>
                                        <p:column width="10%" class="text-center" headerText="#{bundle['dataverse.permissionsFiles.files.tabHeader.draftRestrictedState']}" rendered="#{manageFilePermissionsPage.dataset.latestVersion.draft}">
                                            <c:set var="fileVersion" value="#{fileEntry.key.fileMetadata.datasetVersion.id}" />
                                            <c:set var="dsPublishedVersion" value="#{manageFilePermissionsPage.dataset.releasedVersion.id}" />
                                            <c:set var="dsLatestVersion" value="#{manageFilePermissionsPage.dataset.latestVersion.id}" />
                                            <c:set var="latestVersionRestricted" value="#{fileEntry.key.fileMetadata.restricted}" />
                                            <h:outputText value="#{bundle['dataverse.permissionsFiles.files.deleted']}" rendered="#{fileVersion eq dsPublishedVersion}"/>
                                            <h:outputText value="#{bundle['dataverse.permissionsFiles.files.restricted']}" rendered="#{fileVersion eq dsLatestVersion and latestVersionRestricted}"/>
                                            <h:outputText value="#{bundle['dataverse.permissionsFiles.files.public']}" rendered="#{fileVersion eq dsLatestVersion and !latestVersionRestricted}"/>
                                        </p:column>
                                        <p:column width="18%" class="text-center" headerText="#{bundle['dataverse.permissionsFiles.files.tabHeader.roleAssignees']}">
                                            <p:commandLink id="viewUserGroups" styleClass="btn btn-default"
                                                           rendered="#{fileEntry.value.size() > 0}"
                                                           actionListener="#{manageFilePermissionsPage.initViewRemoveDialogByFile(fileEntry.key, fileEntry.value)}"
                                                           update=":#{p:resolveClientId('rolesPermissionsForm:viewRemoveDialog', view)}"
                                                           oncomplete="PF('viewRemoveWidget').show();">
                                                <h:outputText value="#{fileEntry.value.size()} #{fileEntry.value.size() eq 1 ?  bundle['dataverse.permissionsFiles.files.roleAssignee'] : bundle['dataverse.permissionsFiles.files.roleAssignees']}"/>
                                            </p:commandLink>
                                            <h:outputText rendered="#{fileEntry.value.size() == 0}" value="#{fileEntry.value.size()} #{bundle['dataverse.permissionsFiles.files.roleAssignees']}"/>
                                        </p:column>
                                        <p:column width="22%" class="text-center" headerText="#{bundle['dataverse.permissionsFiles.files.tabHeader.access']}">
                                            <p:commandLink styleClass="btn btn-default"
                                                           actionListener="#{manageFilePermissionsPage.initAssignDialogByFile(fileEntry.key)}"
                                                           update=":#{p:resolveClientId('rolesPermissionsForm:assignDialog', view)}"
                                                           oncomplete="PF('assignWidget').show();handleResizeDialog('assignDialog');bind_bsui_components();"><span class="glyphicon glyphicon-plus"/> #{bundle['dataverse.permissionsFiles.files.assignBtn']}</p:commandLink>
                                        </p:column>
                                    </p:dataTable>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- View / Remove Users/Groups Popup -->
                    <p:dialog id="viewRemoveDialog" styleClass="largePopUp" header="#{bundle['dataverse.permissionsFiles.viewRemoveDialog.header']}" widgetVar="viewRemoveWidget" modal="true">
                        <div>
                            <p:outputPanel id="selectionRemoveCounter">
                                <p>
                                    <h:outputFormat styleClass="highlightBold" value="#{bundle['dataverse.permissionsFiles.files.selected']}">
                                        <f:param value="#{manageFilePermissionsPage.selectedRoleAssignmentRows.size()}"/>
                                        <f:param value="#{manageFilePermissionsPage.roleAssignments.size()} "/>
                                        <f:param value="#{!empty manageFilePermissionsPage.selectedFile ? bundle['dataverse.permissionsFiles.files.roleAssignees'] : bundle['dataverse.permissionsFiles.files']}"/>
                                    </h:outputFormat>
                                </p>
                            </p:outputPanel>
                            
                            <p:dataTable id="assignedRoles" var="roleAssignment" value="#{manageFilePermissionsPage.roleAssignments}"
                                         selection="#{manageFilePermissionsPage.selectedRoleAssignmentRows}" rowKey="#{roleAssignment.id}" 
                                         sortBy="#{!empty manageFilePermissionsPage.selectedFile ? roleAssignment.assigneeDisplayInfo.title : roleAssignment.definitionPoint.displayName}"
                                         scrollable="true" scrollHeight="300" disabledSelection="#{!roleAssignment.definitionPoint.instanceofDataFile}">
                                
                                <p:ajax event="rowSelectCheckbox"  update=":rolesPermissionsForm:selectionRemoveCounter" />
                                <p:ajax event="rowUnselectCheckbox"  update=":rolesPermissionsForm:selectionRemoveCounter" />
                                <p:ajax event="toggleSelect"  update=":rolesPermissionsForm:selectionRemoveCounter" />
                                
                                <p:column selectionMode="multiple" style="width:2%;text-align:center"/>
                                <p:column width="98%" headerText="#{bundle['dataverse.permissionsFiles.usersOrGroups.tabHeader.userOrGroup']}" rendered="#{!empty manageFilePermissionsPage.selectedFile}">
                                    <h:outputText value="#{roleAssignment.assigneeDisplayInfo.title}"/> <h:outputText value=" (#{roleAssignment.assigneeDisplayInfo.affiliation})" rendered="#{!empty roleAssignment.assigneeDisplayInfo.affiliation}"/>
                                </p:column>
                                <p:column width="98%" headerText="#{bundle['dataverse.permissionsFiles.files.tabHeader.fileName']}" rendered="#{!empty manageFilePermissionsPage.selectedRoleAssignee}">
                                    <h:outputText value="#{roleAssignment.definitionPoint.displayName}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                        <div class="button-block">
                            <p:commandLink styleClass="btn btn-default"
                                           update="userGroups restrictedFiles @([id$=Messages])" onclick="PF('confirmation').show()">
                                <span class="glyphicon glyphicon-remove"/>
                                <h:outputText value="#{bundle['dataverse.permissionsFiles.viewRemoveDialog.removeBtn']}"/>
                            </p:commandLink>
                            <button class="btn btn-link" onclick="PF('viewRemoveWidget').hide()" type="button">
                                #{bundle.cancel}
                            </button>
                        </div>
                    </p:dialog>
                    <!-- Assign Users/Groups Popup -->
                    <p:dialog id="assignDialog" styleClass="largePopUp" header="#{bundle['dataverse.permissionsFiles.assignDialog.header']}" widgetVar="assignWidget" modal="true">
                        <p:focus context="assignDialog"/>
                        <p:fragment id="assignMessages">
                            <div class="messagePanel">
                                <iqbs:messages collapsible="true" />
                            </div>
                        </p:fragment>
                        <p:fragment id="assignRoleContent">
                            <div class="form-horizontal">
                                <p class="help-block">#{bundle['dataverse.permissionsFiles.assignDialog.description']}</p>
                                <div class="form-group" jsf:rendered="#{empty manageFilePermissionsPage.fileRequester}">
                                    <label for="userGroupAccessInput" class="col-sm-3 control-label">
                                        #{bundle['dataverse.permissionsFiles.assignDialog.userOrGroup']}
                                    </label>
                                    <div class="col-sm-5">
                                        <p:autoComplete id="userGroupNameAssign" placeholder="#{bundle['dataverse.permissionsFiles.assignDialog.userOrGroup.enterName']}"
                                                        multiple="true" scrollHeight="180" forceSelection="true" 
                                                        minQueryLength="2" queryDelay="1000"                                      
                                                        groupBy="#{roleAssignee.identifier.startsWith('@')?'Users':'Groups'}"                                              
                                                        emptyMessage="#{bundle['dataverse.permissionsFiles.assignDialog.userOrGroup.invalidMsg']}"
                                                        value="#{manageFilePermissionsPage.selectedRoleAssignees}"  
                                                        completeMethod="#{manageFilePermissionsPage.completeRoleAssignee}"
                                                        required="#{param['DO_VALIDATION']}" requiredMessage="#{bundle['dataverse.permissionsFiles.assignDialog.userOrGroup.requiredMsg']}"
                                                        styleClass="DropdownPopup" panelStyleClass="DropdownPopupPanel"
                                                        var="roleAssignee" itemLabel="#{roleAssignee.displayInfo.title}" itemValue="#{roleAssignee}" converter="roleAssigneeConverter">
                                            <p:column>
                                                <h:outputText value="#{roleAssignee.displayInfo.title}"/> 
                                                <h:outputText value=" (#{roleAssignee.displayInfo.affiliation})" rendered="#{!empty roleAssignee.displayInfo.affiliation}"/>
                                            </p:column>
                                            <p:column>
                                                <h:outputText value="#{roleAssignee.identifier}"/>
                                            </p:column>
                                            <p:ajax process="@this" event="itemSelect" />
                                            <p:ajax process="@this" event="itemUnselect" />
                                        </p:autoComplete>
                                        <script>
                                            handle_dropdown_popup_scroll();
                                        </script>
                                        <p:message for="userGroupNameAssign" display="text"/>
                                    </div>
                                </div>
                            </div>
                            <div>
                                <p:outputPanel id="selectionCounter">
                                    <p>
                                        <h:outputFormat styleClass="highlightBold" value="#{bundle['dataverse.permissionsFiles.files.selected']}">
                                            <f:param value="#{manageFilePermissionsPage.selectedFiles.size()}"/>
                                            <f:param value="#{!empty manageFilePermissionsPage.fileRequester ? 
                                                        manageFilePermissionsPage.fileAccessRequestMap.get(manageFilePermissionsPage.fileRequester).size()
                                                        :
                                                        manageFilePermissionsPage.fileMap.size()}"/>
                                            <f:param value="#{!empty manageFilePermissionsPage.fileRequester ? 
                                                        bundle['dataverse.permissionsFiles.files.requested']
                                                        :
                                                        bundle['dataverse.permissionsFiles.files']}"/>
                                        </h:outputFormat>
                                    </p>
                                </p:outputPanel>

                                <o:importFunctions type="java.util.Arrays" />
                                <p:dataTable id="restrictedFilesForAccess" var="file"
                                             value="#{empty manageFilePermissionsPage.fileRequester ? Arrays:asList(manageFilePermissionsPage.fileMap.keySet().toArray()) :
                                                      manageFilePermissionsPage.fileAccessRequestMap.get(manageFilePermissionsPage.fileRequester)}"
                                             selection="#{manageFilePermissionsPage.selectedFiles}" rowKey="#{file.id}" sortBy="#{file.displayName}"
                                             scrollable="true" scrollHeight="300">

                                    <p:ajax event="rowSelectCheckbox"  update=":rolesPermissionsForm:selectionCounter" />
                                    <p:ajax event="rowUnselectCheckbox" update=":rolesPermissionsForm:selectionCounter" />
                                    <p:ajax event="toggleSelect"  update=":rolesPermissionsForm:selectionCounter" />

                                    <p:column selectionMode="multiple" style="width:2%;text-align:center"/>
                                    <p:column headerText="#{bundle['dataverse.permissionsFiles.assignDialog.fileName']}">
                                        <h:outputText value="#{file.displayName}"/>
                                    </p:column>
                                </p:dataTable>
                            </div>
                            <div class="button-block">
                                <p:commandLink styleClass="btn btn-default" rendered="#{empty manageFilePermissionsPage.fileRequester}"
                                               update="@form"
                                               actionListener="#{manageFilePermissionsPage.grantAccess}" oncomplete="if (args &amp;&amp; !args.validationFailed) PF('assignWidget').hide();">
                                    <f:param name="DO_VALIDATION" value="true"/>
                                    <span class="glyphicon glyphicon-ok"/>
                                    <h:outputText value="#{bundle['dataverse.permissionsFiles.assignDialog.grantBtn']}"/>
                                </p:commandLink>
                                <p:commandLink styleClass="btn btn-default" rendered="#{!empty manageFilePermissionsPage.fileRequester}"
                                               update="@form"
                                               actionListener="#{manageFilePermissionsPage.grantAccessToRequests(manageFilePermissionsPage.fileRequester)}" oncomplete="PF('assignWidget').hide();">
                                    <span class="glyphicon glyphicon-ok"/>
                                    <h:outputText value="#{bundle['dataverse.permissionsFiles.assignDialog.grantBtn']}"/>
                                </p:commandLink>
                                <p:commandLink styleClass="btn btn-default" rendered="#{!empty manageFilePermissionsPage.fileRequester}"
                                               update="@form"
                                               actionListener="#{manageFilePermissionsPage.rejectAccessToRequests(manageFilePermissionsPage.fileRequester)}" oncomplete="PF('assignWidget').hide();">
                                    <span class="glyphicon glyphicon-ban-circle"/>
                                    <h:outputText value="#{bundle['dataverse.permissionsFiles.assignDialog.rejectBtn']}"/>
                                </p:commandLink>
                                <button class="btn btn-link" onclick="PF('assignWidget').hide()" type="button">
                                    #{bundle.cancel}
                                </button>
                            </div>
                        </p:fragment>
                    </p:dialog>
                    <p:dialog id="accessFileRemoveConfirm" header="#{bundle['dataverse.permissionsFiles.viewRemoveDialog.removeBtn']}" widgetVar="confirmation" modal="true">
                        <p class="help-block">
                            <span class="glyphicon glyphicon-warning-sign text-warning"/> <span class="text-warning">#{bundle['dataverse.permissionsFiles.viewRemoveDialog.removeBtn.confirmation']}</span>
                        </p>
                        <div class="button-block">
                            <p:commandButton styleClass="btn btn-default" value="#{bundle.continue}" onclick="PF('confirmation').hide()"
                                             action="#{manageFilePermissionsPage.removeRoleAssignments()}"
                                             process="@this"
                                             update=":#{p:resolveClientId('rolesPermissionsForm:userGroups', view)} :#{p:resolveClientId('rolesPermissionsForm:restrictedFiles', view)} @([id$=Messages])"
                                             oncomplete="PF('viewRemoveWidget').hide();"/>
                            <button class="btn btn-link" onclick="PF('confirmation').hide();" type="button">
                                #{bundle.cancel}
                            </button>
                        </div>
                    </p:dialog>
                </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
